from abc import ABC, abstractmethod

class BaseTranslator(ABC):
    """
    Abstract base class for all translation services.
    Defines the common interface that all translators must implement.
    """
    def __init__(self, model=None, api_key=None, base_url=None):
        """
        Constructor.
        :param model: The name of the model to use.
        :param api_key: API key (optional, if the service requires it).
        :param base_url: Base URL for the API (optional).
        """
        self.model = model
        self.api_key = api_key
        self.base_url = base_url

    @abstractmethod
    def translate(self, texts, source_lang, target_lang):
        """
        Translates a list of texts.

        :param texts: A list of strings to be translated.
        :param source_lang: The source language code (e.g., 'en').
        :param target_lang: The target language code (e.g., 'zh-CN').
        :return: A list of translated strings.
        :raises: Exception if the translation fails.
        """
        pass

    @staticmethod
    @abstractmethod
    def get_name():
        """
        Returns the name of the translation service for display in the UI.
        """
        pass